#!/usr/bin/python3


from optparse import OptionParser
import sys
import os


sys.path.append("/usr/lib/linx-sec-center")
import ct_core

def create_parser():
    USAGE_MES="%prog \
            \n  Default:Request no argument, you could input mac default label\
            \n          in stdin, and when you finished, Ctrl+D will be back\
            \n          and write the new label to system if the The inputs correct!\
            \n Example:\
            \n secadmin~$ %prog \
            \n 2 3 4\
            \n EOF          "
    parse = OptionParser(usage=USAGE_MES,version="%prog 1.0")
    return parse

def set_def_label():
    line = sys.stdin.readline()
    l = line.split()
    if len(l) != 3:
        print("Sorry, you input default label %s error!" %l)
        return
    else:
        f1,f2,f3=l
   
    ct_core.write_mac_def_file(f1, f2, f3)


def main():
    parser = create_parser()
    args,flg = parser.parse_args()

    if not flg:
        print("Please input the new default label:")
        set_def_label()
        return
    else:
        parser.error("Argument error, %prog request no argument!")

main()
